home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / ECLAZZ.DEM < prev    next >
Text File  |  1991-04-29  |  1KB  |  47 lines

  1. PROGRAM d8r11(input,output);
  2. (* driver for routine ECLAZZ *)
  3. CONST
  4.    n=15;
  5. TYPE
  6.    glnarray = ARRAY [1..n] OF integer;
  7. VAR
  8.    i,j,k,lclas,nclass : integer;
  9.    nf,nflag,nsav : glnarray;
  10.  
  11. FUNCTION equiv(i,j: integer): boolean;
  12. BEGIN
  13.    equiv := FALSE;
  14.    IF ((i MOD 4) = (j MOD 4)) THEN  equiv := TRUE
  15. END;
  16.  
  17. (*$I MODFILE.PAS *)
  18. (*$I ECLAZZ.PAS *)
  19.  
  20. BEGIN
  21.    eclazz(nf,n);
  22.    FOR i := 1 to n DO BEGIN
  23.       nflag[i] := 1
  24.    END;
  25.    writeln;
  26.    writeln('Numbers from 1-15 divided according to');
  27.    writeln('their value modulo 4:');
  28.    lclas := 0;
  29.    FOR i := 1 to n DO BEGIN
  30.       nclass := nf[i];
  31.       IF (nflag[nclass] <> 0)  THEN BEGIN
  32.          nflag[nclass] := 0;
  33.          lclas := lclas+1;
  34.          k := 0;
  35.          FOR j := i to n DO BEGIN
  36.             IF (nf[j] = nf[i]) THEN BEGIN
  37.                k := k+1;
  38.                nsav[k] := j
  39.             END
  40.          END;
  41.          write('Class',lclas:2,':   ');
  42.          FOR j := 1 to k DO write(nsav[j]:3);
  43.          writeln
  44.       END
  45.    END
  46. END.
  47.